package com.example.gateway.filter;

import com.netflix.zuul.ZuulFilter;

/**
 * Created by atom on 2017/11/21
 */
public class ThrowExceptionFilter extends ZuulFilter {
    @Override
    public String filterType() {
        return "pre";
    }

    @Override
    public int filterOrder() {
        return 0;
    }

    @Override
    public boolean shouldFilter() {
        return false;
    }

    @Override
    public Object run() {
        System.out.println("--------------------- throw exception filter run------------------------");
        dosth();
        return null;
    }

    private void dosth() {
        throw new RuntimeException("I throw a runtime exception....");
    }
}
